package com.telecom.cms.actions;

import java.sql.Connection;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.telecom.cms.dao.SEG_BOOKMARK_DEFDAO;
import com.telecom.cms.dao.GetConnect;


/**
 * @author yueyingnishang
 * 
 */
public class ResultgetAction extends Action {

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping,
	 *      org.apache.struts.action.ActionForm,
	 *      javax.servlet.http.HttpServletRequest,
	 *      javax.servlet.http.HttpServletResponse)
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		// TODO Auto-generated method stub

		// Connection con = GetConnect.getConnection();
		// SEG_BIZ_ATOM_DEF_NEWDAO dao = new SEG_BIZ_ATOM_DEF_NEWDAO(con);
		// List list = dao.findAll();
		// request.getSession().setAttribute("Resultshow", list);

		String method = request.getParameter("method");
		Connection con = GetConnect.getCsConnection();

		String returnword = "";

		SEG_BOOKMARK_DEFDAO dao = new SEG_BOOKMARK_DEFDAO(con);

		List list = dao.findById(2);

		request.setAttribute("Resultdisplay", list);

		if ("query".equalsIgnoreCase(method)) {
			request.setAttribute("copycondition", "yes");
			returnword = "success";
		} else if ("pickup".equalsIgnoreCase(method))

		{
			returnword = "failure";
		}

		return mapping.findForward(returnword);

	}

}
